import request from '@/utils/request'

// 查询货主订单编号规则配置列表
export function listOrderNumberRule(query) {
  return request({
    url: '/wms/orderNumberRule/list',
    method: 'get',
    params: query
  })
}

// 查询货主订单编号规则配置详细
export function getOrderNumberRule(ruleId) {
  return request({
    url: '/wms/orderNumberRule/' + ruleId,
    method: 'get'
  })
}

// 新增货主订单编号规则配置
export function addOrderNumberRule(data) {
  return request({
    url: '/wms/orderNumberRule',
    method: 'post',
    data: data
  })
}

// 修改货主订单编号规则配置
export function updateOrderNumberRule(data) {
  return request({
    url: '/wms/orderNumberRule',
    method: 'put',
    data: data
  })
}

// 删除货主订单编号规则配置
export function delOrderNumberRule(ruleId) {
  return request({
    url: '/wms/orderNumberRule/' + ruleId,
    method: 'delete'
  })
}

// 根据货主ID查询订单编号规则配置列表
export function listOrderNumberRuleByOwnerId(ownerId) {
  return request({
    url: '/wms/orderNumberRule/listByOwnerId/' + ownerId,
    method: 'get'
  })
}

// 生成订单编号
export function generateOrderNumber(ownerId, orderType) {
  return request({
    url: '/wms/orderNumberRule/generate/' + ownerId + '/' + orderType,
    method: 'post'
  })
}

// 预览订单编号格式
export function previewOrderNumber(data) {
  return request({
    url: '/wms/orderNumberRule/preview',
    method: 'post',
    data: data
  })
}